<template>
  <div class="app">
    <router-view v-if="isRouterAlive"></router-view>
  </div>
</template>

<script lang="ts">
import { ref, nextTick, provide } from 'vue';
export default {
  setup() {
    //强制刷新
    const isRouterAlive = ref(true);
    const reload = () => {
      console.log('123');
      isRouterAlive.value = false;
      nextTick(function() {
        isRouterAlive.value = true;
        console.log('456');
      });
    };
    provide('reload', reload);
    return {
      isRouterAlive,
    };
  },
};
</script>

<style lang="scss">
@import '@/assets/css/element.scss';
body {
  margin: 0;
}
</style>
